import requestInstance from '/utils/http.js'

/**
 * @description 商品详情加入购物车 以及 购物车更新商品数量
 * @param {Object}  param {goodsId 商品ID,count 数量,blessing 祝福语}
 * @returns {Promise}
 */
export const reqAddCart = ({goodsId,count,...data})=>{
	// console.log(goodsId,count,data);
	return requestInstance.get(`/cart/addToCart/${goodsId}/${count}`,data)
}
/**
 * @description 获取购物车列表
 * @return {Promise}
 */
export const reqCartList=()=>{
	return requestInstance.get('/cart/getCartList')
}
/**
 * @description 更新商品状态
 * @param  {string} goodsId 商品ID 
 * @param {number} isChecked 是否选中
 * @returns {Promise}
 */
export const reqUpdateGoods = (goodsId,isChecked)=>{
	return requestInstance.get(`/cart/checkCart/${goodsId}/${isChecked}`)
}
/**
 * @description 全选或全不选
 * @param {number} isChecked 0全不选，全选
 * @returns {Promise}
 */
export const reqCheckAllStatus =(isChecked)=>{
	return requestInstance.get(`/cart/checkAllCart/${isChecked}`)
}
/**
 * @description 删除购物车商品
 * @param {string} goodsId 商品Id
 * @returns {Promise}
 */
export const reqDelCartGoods =(goodsId)=>{
	return requestInstance.get(`/cart/delete/${goodsId}`)
}